Skip to content

fix(kdrv): Bound the drain after a panel read - #122

Merged
jbenedictocenteno merged 2 commits into
developfrom
fix/display-read-drain-bounded
Nov 13, 2026
Merged

jbenedictocenteno merged 2 commits into
developfrom
fix/display-read-drain-bounded

Conversation

@mquerostudio

Copy link
Copy Markdown
Contributor

Description of Change

panel_read1() bounds every wait on the DSI host but the last one: the loop that empties the read FIFO after the answer ran for as long as the FIFO did not read empty. A host whose FIFO never empties held the display task there until the task watchdog rebooted the board, which is the one hang the function says it does not have.

  • The drain stops after PANEL_READ_DRAIN_MAX (64) words, far more than the answer to a one-byte read leaves. The byte asked for was read before it, so the read still answers.
  • On the board nothing changes.
  • With no DSI host (kode-sim on esp-emu reads the host's flags as 0) the ID probe passes, and a resume of a glass left lit sees a panel that is not awake (0Ah reads 0) and takes the full bring-up. Today every app built on v0.1.0 or later reboots before its first frame in kode-sim, at the probe, and kodeOS would at a resume.

Test Scenarios

  • tools/host_tests.sh: 5490 cases across 8 suites, all passing. tools/check_layers.sh clean.
  • kode-sim's emulator suite (esp-emu 1.0.0, ESP-IDF v6.1) against this branch: display_lvgl draws, kodeOS boots to its UI, an app installs and goes home by the held button and by reset with the glass kept lit, review runs - 16 of 16 display and kodeOS cases. Against main the display ones fail: the task watchdog fires in the display task 6 s into the boot.
  • Not run on a DVT board: the change only touches what happens after the answer was read, a loop that ends at once on a working host.

Related links

Seen in kodediy/kode-sim while moving it to the newest kode-sdk.

panel_read1() bounds every wait on the DSI host but the last one: the loop
that empties the read FIFO after the answer ran for as long as the FIFO
did not read empty. A host whose FIFO never empties held the display task
there until the task watchdog rebooted the board, the one hang the
function says it does not have. An emulator without a DSI host reads the
flag as 0, so every app on v0.1.0 and later rebooted before its first
frame in kode-sim, at the ID probe and again at a resume of a glass left
lit.

The drain now stops after PANEL_READ_DRAIN_MAX words, far more than the
answer to a one-byte read leaves. The byte asked for was read before it,
so the read still answers: on the board nothing changes, and with no DSI
host the probe passes and a resume sees a panel that is not awake and
takes the full bring-up.
The drain after a DCS read is bounded so that a host that is not there
cannot hold the display task. Reaching the bound still answered KODE_OK
without a word: on a board that is a DSI host that does not answer, and
nothing in the log said so. The read warns when it stops with the FIFO
still not empty.
@jbenedictocenteno
jbenedictocenteno changed the base branch from main to develop November 13, 2026 15:59
@jbenedictocenteno
jbenedictocenteno merged commit 3c15bd7 into develop Nov 13, 2026
6 checks passed
@jbenedictocenteno

Copy link
Copy Markdown
Contributor

Thanks for bringing this in. It was the one unbounded wait left in a function that promises none, and it is merged into develop now.

Two things changed on the way, so you know what landed:

  • The base. The pull request pointed at main. Work lands on develop, and main only moves at a release. The branch already sat on develop's tip, so only the base had to change: one file instead of 108.
  • One commit on top: fix(kdrv): Say when a panel read's drain stops at its bound. When the drain stops at PANEL_READ_DRAIN_MAX with the FIFO still not empty, the read now says so with a warning. On a real board that is a DSI host that does not answer, and the read used to answer KODE_OK without a word. In an emulator with no DSI host the line shows at each panel read, which is also true there.

Checked before merging: a kodeOS build with both commits boots twice on a board, the face comes up, and the display driver logs no warning, so the drain never reaches its bound on real hardware. Size, RAM budget, layer rules and the MISRA gate are as they were.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants